﻿using System;
using System.Drawing;
using System.Windows.Forms;
using ReportWizard.Helpers;

namespace ReportWizard.Forms
{
    public partial class IconForm : Form
    {
        #region events

        public event EventHandler ClickOk;
        public event EventHandler ClickCancel;
        public event EventHandler ClickCustomLeft;
        public event EventHandler ClickCustomRight;
        public event EventHandler FormCheckFooterCheckedChanged;

        #endregion

        #region string properties

        public string HeaderText
        {
            get { return lFormCaption.Text; }
            set { lFormCaption.Text = value; }
        }

        public string CancelButtonText
        {
            get { return bCancel.Text; }
            set { bCancel.Text = value; }
        }

        public string OkButtonText
        {
            get { return bOk.Text; }
            set { bOk.Text = value; }
        }

        public string CustomLeftButtonText
        {
            get { return bCustomLeft.Text; }
            set { bCustomLeft.Text = value; }
        }

        public string CustomRightButtonText
        {
            get { return bCustomRight.Text; }
            set { bCustomRight.Text = value; }
        }

        public string CheckFooterText
        {
            get { return checkFooter.Text; }
            set { checkFooter.Text = value; }
        }

        #endregion

        #region bool properties

        public bool ShowCancelButton
        {
            get { return bCancel.Visible; }
            set { bCancel.Visible = value; }
        }

        public bool ShowOkButton
        {
            get { return bOk.Visible; }
            set { bOk.Visible = value; }
        }

        public bool ShowCustomLeftButton
        {
            get { return bCustomLeft.Visible; }
            set { bCustomLeft.Visible = value; }
        }

        public bool ShowCustomRightButton
        {
            get { return bCustomRight.Visible; }
            set { bCustomRight.Visible = value; }
        }

        public bool ShowCheckFooter
        {
            get { return checkFooter.Visible; }
            set { checkFooter.Visible = value; }
        }

        public bool CheckFooterChecked
        {
            get { return checkFooter.Checked; }
            set { checkFooter.Checked = value; }
        }

        #endregion

        public Image HeaderImage 
        {
            get { return pbFormIcon.Image; }
            set { pbFormIcon.Image = value; }
        }

        public PictureBoxSizeMode HeaderImageSizeMode
        {
            get { return pbFormIcon.SizeMode; }
            set { pbFormIcon.SizeMode = value; }
        }

        public string HeaderImageToolTip
        {
            get { return ttIconForm.GetToolTip(pbFormIcon); }
            set { ttIconForm.SetToolTip(pbFormIcon, value); }
        }

        public IconForm()
        {
            InitializeComponent();
        }

        private void IconFormLoad(object sender, EventArgs e)
        {
            if (ClickOk != null)
                bOk.Click += ClickOk;

            if (ClickCancel != null)
                bCancel.Click += ClickCancel;

            if (ClickCustomLeft != null)
                bCustomLeft.Click += ClickCustomLeft;

            if (ClickCustomRight != null)
                bCustomRight.Click += ClickCustomRight;

            if (FormCheckFooterCheckedChanged != null)
                checkFooter.CheckStateChanged += FormCheckFooterCheckedChanged;

            Text = (MdiParent == null && !Text.Contains(Globals.AssemblyTitle))
                                ? string.Format("{0} - {1}", Globals.AssemblyTitle, Text)
                                : Text;
        }
    }
}
